home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok33.lha
/
SetTool
/
SetTool.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
2KB
|
69 lines
(**********************************************************************
:Program. SetTool.mod
:Contents. Modify default tool of project or disk icons
:Author. Nicolas Benezan [bne]
:Address. Postwiesenstr. 2, D7000 Stuttgart 60
:Phone. 711/333679
:Copyright. Public Domain
:Language. Modula-2
:Translator. M2Amiga A+L V3.3d
:History. V1.0 [bne] 06.Feb.1990
:Usage. Usage = "SetTool" IconName[".info"] [PathName].
**********************************************************************)
MODULE SetTool;
FROM Arguments IMPORT GetArg, NumArgs;
FROM Arts IMPORT returnVal;
FROM Dos IMPORT error;
FROM Icon IMPORT GetDiskObject, PutDiskObject, FreeDiskObject;
FROM SmallInOut IMPORT WriteLn, WriteString;
FROM Strings IMPORT Compare, Delete;
FROM SYSTEM IMPORT ADR;
FROM Workbench IMPORT DiskObject, DiskObjectPtr, WBObjectType;
CONST
Usage = 'Usage: "SetTool" IconName[".info"] [PathName].';
VAR
Icon: DiskObjectPtr;
Name, Tool: ARRAY [0..79] OF CHAR;
Len: INTEGER;
PROCEDURE Error (Message: ARRAY OF CHAR);
BEGIN
WriteString (Message);
WriteLn;
returnVal:= error;
END Error;
BEGIN
GetArg (2, Tool, Len);
GetArg (1, Name, Len);
IF (NumArgs () >= 1) AND (Len < 80) THEN
IF (Len > 5) AND (Compare (Name, Len - 5, 5, ".info", FALSE) = 0) THEN
Delete (Name, Len - 5, 5);
END;
Icon:= GetDiskObject (ADR (Name));
IF Icon # NIL THEN
WITH Icon^ DO
IF (type = project) OR (type = disk) THEN
Icon^.defaultTool:= ADR (Tool);
ELSE
Error ("object of wrong type");
END;
END;
IF NOT PutDiskObject (ADR (Name), Icon) THEN
Error ("cannot replace icon file");
END;
FreeDiskObject (Icon);
ELSE
Error ("object not found");
END;
ELSE
Error (Usage);
END;
END SetTool.